using System;
using Provausio.Common.Objects;
using TrainingManagement.api.Models.Data.CRUD;
using TrainingManagement.api.Models.Data.CRUD.Position;

namespace TrainingManagement.api.Models.BusinessLogic.Position
{
    public class PositionDeleteOperation : BusinessOperation<int, bool>
    {
        readonly PositionDeleteDataSource _positionDelete = new PositionDeleteDataSource();

        public override bool Run(int input)
        {
            if (_positionDelete.Execute(input))
                return true;
            throw new Exception(string.Format("Position (id={0}) was not deleted!", input));
        }
    }
}